package com.demo.utils;

import com.demo.entity.constants.Constants;
import com.demo.entity.dto.SessionWebUserDto;
import com.demo.entity.enums.ResponseCodeEnum;
import com.demo.exception.BusinessException;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: demo
 * @description:
 * @author: 陈程猿
 * @create: 2025-03-03 23:01
 **/

public class LoginInfoUtil {

    public static SessionWebUserDto getSessionWebUserDto() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        SessionWebUserDto webUserDto= (SessionWebUserDto) request.getSession().getAttribute(Constants.SESSION_KEY);
        return webUserDto;
    }
}
